Use case: SDIO direct transfer ¶
A direct I/O transfer accesses a single byte in an SDIO function register space and is commonly used for control/status registers (for example, reading an interrupt status register or writing a configuration value). The sequence and APIs remain unchanged between HAL1 and HAL2.
For example, an SDIO Wi‑Fi device may expose multiple functions where
user_io_func_nbr
selects the Wi‑Fi function; a direct transfer could then read a status register in the Wi‑Fi function or write a control register.
Code Snippet
|
HAL1/HAL2 |
|---|
uint8_t reg_value = 0U;
/* Read a single byte from a function register */
if (HAL_SDIO_ReadDirect(&hsdio,
user_io_func_nbr,
RegisterAddress,
®_value) != HAL_OK)
{
Error_Handler();
}
/* Update configuration register */
reg_value |= REG_ENABLE_MASK; /* Example: enable a specific feature */
/* Write back the updated value to the function register */
if (HAL_SDIO_WriteDirect(&hsdio,
user_io_func_nbr,
RegisterAddress,
reg_value) != HAL_OK)
{
Error_Handler();
}
|